from django.db.models import IntegerField, BooleanField, CharField, TextField,DateTimeField

from apps.vadmin.op_drf.models import CoreModel

'''
分类表
category_type: 有 asset、accessory、component、consumable、license
'''
class Categories(CoreModel):
    name = CharField(null=False, max_length=255,unique=True, verbose_name="分类名称",)
    category_type = CharField(max_length=32,default="asset",verbose_name="分类类型")
    deleted_datetime = DateTimeField(null=True,verbose_name="删除时间")
    eula_text = TextField(null=True,verbose_name="软件许可协议文本")
    use_default_eula = BooleanField(null=False,default=False,verbose_name="是否作为默认的许可协议")
    require_acceptance = BooleanField(null=False,default=False,verbose_name="用户使用这类资产时是否必须同意许可协议")
    checkin_email = BooleanField(null=False,default=False,verbose_name="领用或归还时是否需要邮件通知")
    image = CharField(null=True,max_length=255,verbose_name="图片地址")

    class Meta:
        verbose_name = '分类'
        verbose_name_plural = verbose_name

    def __str__(self):
        return f"{self.name}"
